﻿<Page x:Class="BeautySalon.Pages.ServicePage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:BeautySalon.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="ServicePage" 
      IsVisibleChanged="Page_IsVisibleChanged">

    <Grid Background="Gray">
        
        <Grid.RowDefinitions>
            <RowDefinition Height="377"/>
            <RowDefinition Height="73"/>
        </Grid.RowDefinitions>

        <!--Список с услугами-->
        <DataGrid Name="dGridService"
                  Grid.Row="0"
                  SelectionMode="Single"
                  AutoGenerateColumns="False"
                  IsReadOnly="True">
            
            <!--Столбцы-->
            <DataGrid.Columns>
                
                <DataGridTextColumn Header="Название услуги"
                                    Width="Auto"
                                    Binding="{Binding Title}"/>

                <DataGridTextColumn Header="Стоимость"
                                    Width="Auto"
                                    Binding="{Binding Cost}"/>
                
                <DataGridTextColumn Header="Время"
                                    Width="Auto"
                                    Binding="{Binding DurationInSeconds}"/>
                
                <DataGridTextColumn Header="Скидка"
                                    Width="Auto"
                                    Binding="{Binding Discount}"/>

                <!--Фото-->
                <DataGridTemplateColumn Header="Фото"
                                        Width="130">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Width="80"
                                   Height="80"
                                   VerticalAlignment="Center"
                                   Source="{Binding MainImagePath}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <!--Кнопка-->
                <DataGridTemplateColumn x:Name="EditorSectionBtn"
                                        Visibility="Hidden"
                                        Width="Auto">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="EditBtn"
                                    FontSize="20"
                                    Width="120"
                                    Height="40"
                                    Content="Редактировать"
                                    Click="EditBtn_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

            </DataGrid.Columns>
            
        </DataGrid>
        
        <!--Отображение кол-ва записей из DataGrid-->
        <Label Name="DisplayCountRowsFromDataGridLb"
               Grid.Row="1"
               HorizontalAlignment="Left"
               VerticalAlignment="Top"
               FontSize="15"
               Background="Black"
               Foreground="White"/>
        
        <!--Отображение кол-ва записей из таблицы БД-->
        <Label Name="DisplayCountRowsFromTableLb"
               Grid.Row="1"
               HorizontalAlignment="Right"
               VerticalAlignment="Top"
               FontSize="15"
               Background="Black"
               Foreground="White"/>
        
        <!--Кнопка сортировки услуг по стоимости в большую сторону-->
        <Button Name="SortToCostUpBtn"
                Grid.Row="1"
                Content="+"
                VerticalContentAlignment="Center"
                Padding="0"
                VerticalAlignment="Top"
                Width="15"
                Height="25"
                Margin="20 10 0 0"
                Click="SortToCostUpBtn_Click"/>

        <!--Кнопка сортировки услуг по стоимости в малую сторону-->
        <Button Name="SortToCostDownBtn"
                Grid.Row="1"
                Content="-"
                VerticalContentAlignment="Center"
                Padding="0"
                VerticalAlignment="Bottom"
                Width="15"
                Height="25"
                Margin="20 0 0 10"
                Click="SortToCostDownBtn_Click"/>


        <!--Кнопка добавления-->
        <Button Grid.Row="1"
                Name="AddBtn"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Width="130"
                Height="40"
                Content="Добавить"
                Margin="20 0 0 0"
                Click="AddBtn_Click"/>
        
        <!--Кнопка удаления-->
        <Button Grid.Row="1"
                Name="DeleteBtn"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Width="130"
                Height="40"
                Content="Удалить"
                Margin="0 0 20 0"
                Click="DeleteBtn_Click"/>
        
        <!--Поиск данных-->
        <StackPanel Grid.Row="1"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="0 5 0 0">

            <TextBlock Text="Поиск"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 7 0"/>

            <TextBox Name="SearchTxb"
                     Height="25"
                     Width="120" TextChanged="SearchTxb_TextChanged"/>           
                        
        </StackPanel>

        <!--Фильтрация данных-->
        <StackPanel Grid.Row="1"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Bottom"
                    Margin="0 0 0 5">

            <TextBlock Text="Фильтрация"
                       Foreground="White"
                       VerticalAlignment="Center"
                       Margin="0 0 5 0"/>

            <ComboBox Name="FilterCmbx"
                      Height="25"
                      Width="120" SelectionChanged="FilterCmbx_SelectionChanged"/>

        </StackPanel>

    </Grid>
</Page>
